AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")

--Called when an entity is no longer touching this SENT.
--Return: Nothing
function ENT:EndTouch(entEntity)
end

--Called when the SENT is spawned
--Return: Nothing

function ENT:Initialize()
	self:SetModel("models/props/cs_militia/furnace01.mdl")
	self:SetUseType(SIMPLE_USE)
	self:PhysicsInit( SOLID_VPHYSICS )
	self:SetMoveType( MOVETYPE_NONE )
	self:SetSolid( SOLID_VPHYSICS )
	self:SetColor(255,255,255,255)
	print("Forge Spawned!..")
end

function ENT:Use(ply)
         

    

            --local data = {}
            --data.Entity = self

            --data.Chance = 100
            --data.MinAmount = 1
            --data.MaxAmount = 1

            --ply:DoProcess("Smelting",2,data)
         
end

function ENT:AcceptInput( Name, Activator, Caller )	

	if Name == "Use" and Caller:IsPlayer() then
		
		umsg.Start("SmeltingMenu", Caller) 
		umsg.End() 
		
	end
	
end



--Called when the entity key values are setup (either through calls to ent:SetKeyValue, or when the map is loaded).
--Return: Nothing
function ENT:KeyValue(k,v)
end

--Called when a save-game is loaded.
--Return: Nothing
function ENT:OnRestore()
end

--Called when something hurts the entity.
--Return: Nothing
function ENT:OnTakeDamage(dmiDamage)
end

--Controls/simulates the physics on the entity.
--Return: (SimulateConst) sim, (Vector) linear_force and (Vector) angular_force
function ENT:PhysicsSimulate(pobPhysics,numDeltaTime)
end

--Called when an entity starts touching this SENT.
--Return: Nothing
function ENT:StartTouch(entEntity)
end

--Called when the SENT thinks.
--Return: Nothing
function ENT:Think()




end

function Smelt(ply)
		

			if !ply.InProcess then
		
				local data = {}
				data.Entity = self

				data.Chance = 100
			
				data.MinAmount = 1
				data.MaxAmount = 1

				
				if ply:GetInfo("smelt_type") == "Smelt Copper" then
					if ply:GetInfoNum("smelt_amount") >= 1 then
					 ply:DoProcess("SmeltCopper",2,data)
					end
					
				elseif ply:GetInfo("smelt_type") == "Smelt Iron" then
					if ply:GetInfoNum("smelt_amount") >= 1 then
					ply:DoProcess("SmeltIron",2,data)
					end
				elseif ply:GetInfo("smelt_type") == "Smelt Titanium" then
					if ply:GetInfoNum("smelt_amount") >= 1 then
					ply:DoProcess("SmeltTitanium",2,data)
					end
				end
			end
			
		
end


concommand.Add("smelt_shit",Smelt)
--Called when an entity touches this SENT.
--Return: Nothing
function ENT:Touch(entEntity)
end

--Called when: ?
--Return: TRANSMIT_ALWAYS, TRANSMIT_NEVER or TRANSMIT_PVS
function ENT:UpdateTransmitState(entEntity)
end